package com.sanbi.erp.api.web;

import com.sanbi.erp.api.vo.ResponseVo;
import com.sanbi.erp.db.domain.Provider;
import com.sanbi.erp.db.service.ProviderService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @introduce: 供应商服务
 * @Date: 2022/10/18 18:40
 * @Author: XYP
 */
@Validated
@RestController
@RequestMapping("/erp/provider")
public class ErpProviderController {
    @Resource
    ProviderService providerService;

    /**
     * 获取供应商信息
     * 添加单个商品时使用
     * @param providerName 供应商名称
     * @return
     */
    @GetMapping("/getList")
    public ResponseVo<List<Provider>> getList(@RequestParam(defaultValue = "") String providerName){
        return ResponseVo.ok(this.providerService.selectAll(providerName));
    }

}
